<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class FormRequest extends Request
{
    public function authorize()
    {
        return true;
    }

    protected $messages=[
        'username.required'=>'用户名必须',
        'username.exists'=>'用户名错误或不存在',
        'password.required'=>'密码必须',
        'password.exists'=>'密码错误'
    ];

    public function rules()
    {
        $name=md5(md5(trim(Request::input('username'))));
        return [
        'username' => 'exists:use,Name,Del,1|required',
        'password' => 'exists:use,Pwd,Name,'.$name.'|required'
        ];
    }

    public function messages()
    {
        return $this->messages;
    }


  }
